﻿<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="error.jsp" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/trswas.tld" prefix="TRS"%>
<%@include file="../inc/import_package.jsp"%>
<%@include file="../inc/getsysteminfo.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>搜索结果</title>
    <!-- <link href="css/was.css" rel="stylesheet" type="text/css"/> -->
    <!-- <link href="css/timeline.css" rel="stylesheet" type="text/css"/> -->
    <script type="text/javascript" src="js/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="js/suggest-yui2.js"></script>
    
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/jquery.cookie.min.js"></script>
        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="bootstrap/css/ie10-viewport-bug-workaround.css" rel="stylesheet" type="text/css"/>
    <link href="bootstrap/css/dashboard.css" rel="stylesheet" type="text/css"/>

    <link href="images/S_publicStyle.css" rel="stylesheet" type="text/css" />
    <link href="images/S_sp_index.css" rel="stylesheet" type="text/css" />
    <link href="images/S_sp_ingormationResearch.css" rel="stylesheet" type="text/css" />
    <link href="images/S_informationResearch20161109.css" rel="stylesheet" type="text/css" />

    <link rel="stylesheet" type="text/css" href="css/Sstyle.css">
    <link rel="stylesheet" type="text/css" href="css/toastr.min.css">
    <script type="text/javascript" src="js/toastr.min.js"></script>

    <%
    String hrefadded = "";
    SearchData searchData = WASTools.getSearchDataFromRequest(request);
    String channelID = WASTools.getChannelID(loginConfig, searchData, "");
    String strUrl = WASTools.getURL(request, searchData, loginConfig, channelID);

    String custom_expr = "";
    String searchScope = RequestOperation.getStrParameter(request, "searchscope", "");
    String timeScope =  RequestOperation.getStrParameter(request, "timescope", "");
    String timeScopeColumn = RequestOperation.getStrParameter(request, "timescopecolumn", "");
    String orderBy = WASTools.getOrderBy(WASTools.getChannel(wasConfig, channelID), searchData);
    hrefadded += "searchscope=" + WASEncoding.urlEncoding(searchScope, request);
    hrefadded += "&timescope=" + WASEncoding.urlEncoding(timeScope, request);
    hrefadded += "&timescopecolumn=" + WASEncoding.urlEncoding(timeScopeColumn, request);
    hrefadded += "&orderby=" + WASEncoding.urlEncoding(orderBy, request);

    // ******************************额外参数获取
    String searchWord1 = RequestOperation.getStrParameter(request, "searchWord1", "");
    String searchField1 = RequestOperation.getStrParameter(request, "searchField1", "");

    String searchField2 = RequestOperation.getStrParameter(request, "searchField2", "");
    String searchWord2 = RequestOperation.getStrParameter(request, "searchWord2", "");
    String searchField3 = RequestOperation.getStrParameter(request, "searchField3", "");


    String columnLimit = "";
    if (!StringUtil.isEmpty(searchScope) && !StringUtil.isEmpty(searchData.getAllSearchWord()))
    {
        columnLimit = searchScope + "=(" + searchData.getAllSearchWord() + ")";
    }

    String timeLimit = "";
    // if (!StringUtil.isEmpty(timeScope) && !StringUtil.isEmpty(timeScopeColumn))
    // {
    //     SimpleDateFormat fmt = new SimpleDateFormat("yyyy.MM.dd"); 
        
    //     java.util.Date d = new java.util.Date();
    //     Calendar calendar = Calendar.getInstance();
    //     calendar.setTime(d);
        
    //     String nowDate = fmt.format(calendar.getTime());
    //     if (timeScope.equals("week"))
    //     {
    //         calendar.add(Calendar.DATE, -7);
    //         timeLimit = fmt.format(calendar.getTime());
            
    //         timeLimit = "DocPubTime = between['" + timeLimit + "', '"+ nowDate +"']";
    //     }
    //     else if (timeScope.equals("month"))
    //     {
    //         calendar.add(Calendar.MONTH, -1);
    //         timeLimit = fmt.format(calendar.getTime());
            
    //         timeLimit = "DocPubTime = between['" + timeLimit + "', '"+ nowDate +"']";
    //     }
    //     else if (timeScope.equals("date"))
    //     {
    //         timeLimit = "DocPubTime = ('" + nowDate + "')";
    //     }
    // }

    custom_expr = WASTools.buildSQL(columnLimit, timeLimit, "AND");

    // //高级检索页面传过来的参数
    String andSen = RequestOperation.getStrParameter(request, "andsen", "");
    String total = RequestOperation.getStrParameter(request, "total", "");
    String orSen = RequestOperation.getStrParameter(request, "orsen", "");
    String exclude = RequestOperation.getStrParameter(request, "exclude", "");
    hrefadded += "&andsen=" + WASEncoding.urlEncoding(andSen, request);
    hrefadded += "&total=" + WASEncoding.urlEncoding(total, request);
    hrefadded += "&orsen=" + WASEncoding.urlEncoding(orSen, request);
    hrefadded += "&exclude=" + WASEncoding.urlEncoding(exclude, request);
    String adv_expr = StringUtil.buildAdv(total, andSen, orSen, exclude);

    if (!StringUtil.isEmpty(custom_expr))
    {
        if (StringUtil.isEmpty(columnLimit)) custom_expr = WASTools.buildSQL(searchData.getAllSearchWord(), timeLimit, "AND");
        searchData.setCustomExpr(custom_expr);  //设置后检索以用户自定义的表达式与上频道条件进行检索
    }

    if (!StringUtil.isEmpty(adv_expr))
    {
        if (!StringUtil.isEmpty(searchScope))
            adv_expr = searchScope + "=(" + adv_expr + ")";

        custom_expr = WASTools.buildSQL(adv_expr, timeLimit, "AND");
        
        if (!StringUtil.isEmpty(custom_expr))
            searchData.setCustomExpr(custom_expr);
    }

     WASResultSet wasResultSet = WASTools.getWASResultSet(request, appConfig, wasConfig, loginConfig, searchData, channelID);
    %>

    <script type="text/javascript">

        /**
         * 初始化页面
         */
        $(function(){
            
            $("#searchWord1").val("<%=searchWord1%>");
            $("#searchField1").find("option").each(function(){      
                if ($(this).val() == "<%=searchField1%>") {
                    $(this).attr("selected", true);
                }
            });
       		
       		$("#searchField2").find("option").each(function(){      
                if ($(this).val() == "<%=searchField2%>") {
                    $(this).attr("selected", true);
                }
            });

            $("#searchWord2").val("<%=searchWord2%>");
            $("#searchField3").find("option").each(function(){      
                if ($(this).val() == "<%=searchField3%>") {
                    $(this).attr("selected", true);
                }
            })
        });

        function checkInput() {
            if ($("#searchWord1").val()==''||$("#searchWord1").val()=='请输入检索词1'){
                // alert('请输入检索词');

                toastr.warning('请输入检索词1');
                document.searchform.searchWord1.focus();
                return false;
            }
            else if($("#searchWord2").val()==''||$("#searchWord2").val()=='请输入检索词2'){
                // alert('请输入检索词');

                toastr.warning('请输入检索词2');
                document.searchform.searchWord2.focus();
                return false;
            } 
            else{
                // 组合检索参数
                //alert($("#searchField1").find("option:selected").html());
                //模糊查询
                var searchword = "(" + $("#searchField1").find("option:selected").val() + "=" +"'%"+ $("#searchWord1").val() +"%'" +" "+$("#searchField2").find("option:selected").val()+" "+$("#searchField3").find("option:selected").val()+ "=" +"'%"+ $("#searchWord2").val()+"%'" +")";
                //精准查询
                // var searchword = "(" + $("#searchField1").find("option:selected").val() + "=" + $("#searchWord1").val() + " "+
                // 				$("#searchField2").find("option:selected").val()+" "+$("#searchField3").find("option:selected").val()+ "=" + $("#searchWord2").val()+ ")";
                // alert(searchword);
                $("#searchword").val(searchword);
                $("#searchform").submit();
                return true;
            }
        }

        function resetInput() {
            // 组合检索参数
            //alert($("#searchField1").find("option:selected").html());
            //var searchword = "(" + $("#searchField1").find("option:selected").val() + "=" + $("#searchWord1").val() + ")";
            $("#searchField1").val("");
            $("#searchWord1").val("");

            $("#searchField2").val("");
            $("#searchWord2").val("");
            $("#searchField3").val("");

            $("#searchword").val("");
            $("#searchform").submit();
            return true;
        }

		function selectAll() {
		    var ipt=document.getElementsByTagName("input");
		    for(var i=0;i<ipt.length;i++){
		        if(ipt[i].type=="checkbox"){
		    		ipt[i].checked=!ipt[i].checked;
		        }
		    }
		           
		} 
	</script>
</head>

<body>
	<!--sp_headeryx s-->
	<div class="sp_headeryx">
		<div class="sp_headyx">
		    <div class="sp_headyx1">2016年09月05日 星期一</div>
		    <div class="sp_headyx2">
			    <form action="" name="login" class="color313131">
			        <label>用户名:</label>
			        <input type="text" class="input1 margin-right1"/>
			        <label>密码:</label>
			        <input type="password" class="input2"/> 
			        <input type="submit" value="登录" class="input3 btn btn-primary"/>
			    </form>
		    </div>
		    <div class="sp_headyx3">
			    <p class="sp_headyx3-1 margin-right1">收藏本站</p>
			    <p class="sp_headyx3-2">设为首页</p>
		    </div>
		</div>
	</div>
	<!--sp_headeryx e-->
	<!--sp_logoyx s-->
	<div class="fileMan_logo">
	  	<div class="inforResearchW"></div>
	</div>
	<!--sp_logoyx e-->
	<!--sp_navyx s-->
	<div class="sp_navyx fontSize18">
		<div class="sp_navyx1">
		    <ul>
			    <li><a href="#">首&nbsp;&nbsp;页</a></li>
			    <li><a href="#">情报研究</a></li>
			    <li><a href="#">知识产权</a></li>
			    <li><a href="#">标准化</a></li>
			    <li><a href="#">期刊出版</a></li>
			    <li><a href="#">档案管理</a></li>
			    <li class="sp_navyx1-1"><a href="#">图书管理</a></li>
		    </ul>
		</div>
	</div>
	<!--sp_navyx e-->
	
	<!--sp_mainyx s-->
	<div class="sp_mainyx">
		<!--inforResearch_mainContentLeft s-->
		<div class="inforResearch_mainContentLeft">
		    <!--inforResearch_mainContentLeft_1 s-->
		    <div class="inforResearch_mainContentLeft_1 marginBottom10">
		      	<div class="inforResearch_mainContentLeft_11">
		          	<div class="std_1">国内外高速柴油机参数</div>
		      	</div>
		    </div>
		    <!--inforResearch_mainContentLeft_1 e-->  
		</div>
		<!--inforResearch_mainContentLeft e-->
		<!--sp_iryxR s-->
		  <div class="sp_iryxR">
		    	<!--sp_iryxRT S-->
		    	<div class="sp_iryxRT">
		        	<form name="searchform" id="searchform" action="search" method="get">
		        		<input type="hidden" name="channelid" id="channelid" value="216181">
		        		<input type="hidden" name="searchword" id="searchword" value="">
		            	<select name="searchField1" id="searchField1" class="sp_tyyx">
		                	<option value="sccs">生产厂商</option>
						  	<option value="fdjxh">发动机型号</option>
						  	<option value="gb">国别</option>
						  	<option value="fdjlx">发动机类型</option>
		                </select>
		                <input type="text" name="searchWord1" id="searchWord1" class="sp_tyyx" />
		                <select name="searchField2" id="searchField2" class="sp_tyyx">
		                	<option value="and">与</option>
		                    <option value="or">或</option>
		                </select>
		                <select name="searchField3" id="searchField3" class="sp_tyyx">
		                	<option value="sccs">生产厂商</option>
						  	<option value="fdjxh">发动机型号</option>
						  	<option value="gb">国别</option>
						  	<option value="fdjlx">发动机类型</option>
		                </select>
		                <input type="text" name="searchWord2" id="searchWord2" class="sp_tyyx"/>
		                <div class="sp_irtj">
		                	<input type="button" value="检索" class="sp_irjs" onclick="checkInput();"/>
		                    <input type="button" value="重置" class="sp_ircz" onclick="resetInput();"/>
		                    <div class="clear"></div>
		                </div>
		            </form>
		        </div>
		        <!--sp_iryxRT e-->
		        <!--s_qbyjT s-->
		        <div class="s_qbyjT">
		            <!--s_qbyjTa s-->
		          	<div class="s_qbyjTa marginBottom20">
			            <div class="table-responsive">
			              	<table class="table table-bordered ">
				                <thead>
					                <tr>
					                    <th id="checkbox-all" width="10">
					                      	<input type="checkbox"  id="ck" onclick="javascript:selectAll()" />
					                    </th>
					                    <th>#</th>
					                    <th>生产厂商</th>
					                    <th>发动机型号</th>
					                    <th>国别</th>
					                    <th>发动机类型</th>
					                </tr>
				                </thead>
				                <tbody>
					                <TRS:Outline>
					                    <TRS:Record>
						                    <tr>
						                        <td><input type="checkbox" name="pushcheck"></td>  
						                        <td><TRS:Column formattypeinforadar="ignore"  name="WCMMetaTablecyjcsID" showpoint="yes" cutsize="40" showmore="no">标题</TRS:Column></td>
						                        <td><TRS:Column formattypeinforadar="ignore"  name="sccs" showpoint="yes" cutsize="40" showmore="no">标题</TRS:Column></td>
						                        <td><a href="detail" class="searchresulttitle" target="_blank">
						                        <TRS:Column formattypeinforadar="ignore"  name="fdjxh" showpoint="yes" cutsize="40" showmore="no">标题</TRS:Column></a></td>
						                        <td><TRS:Column formattypeinforadar="ignore"  name="gb" showpoint="yes" cutsize="40" showmore="no">标题</TRS:Column></td>
						                        <td><TRS:Column formattypeinforadar="ignore"  name="fdjlx" showpoint="yes" cutsize="40" showmore="no">标题</TRS:Column></td>
						                    </tr>
					                    </TRS:Record>
					                </TRS:Outline>
				                </tbody>
			              	</table>
			            </div>
			            <div>
			              <TRS:OutlineBar icon="no"></TRS:OutlineBar>
			            </div>
		          	</div>
		          	<!--s_qbyjTa e-->
		            <!--分页开始-->
		            <div class="m_page">
		              	<a href="#" class="lastPage marginRight5 ">上一页</a><a href="#" class="marginRight5 hover4">1</a><a href="#" class="marginRight5">2</a><a href="#" class="marginRight5">3</a><a href="#" class="marginRight5">4</a><a href="#" class="marginRight5">5</a><a href="#">6</a>&nbsp;...&nbsp;<a href="#" class="marginRight5">199</a><a href="#" class="marginRight5">200</a><a href="#" class="marginRight5">下一页</a>
		            </div>
		            <!--分页结束-->
		        </div>
		        <!--s_qbyjT e-->
		    </div>
		    <!--sp_iryxR e-->
	    <div class="clear"></div>
	</div>
	<!--sp_mainyx e-->
	<!--foot s-->
	<div class="sp_indexfooter">
	  	<div class="sp_indexfoot">
	      	<p>技术支持：技术基础部&nbsp;&nbsp;&nbsp;后台登录 </p>
	        <p>文章数量：<span>111</span>&nbsp;&nbsp;&nbsp;&nbsp;图片数量:<span>111</span>&nbsp;&nbsp;&nbsp;&nbsp;总访问量量：<span>111</span>&nbsp;&nbsp;&nbsp;&nbsp;当前在线人数：<span>111</span></p>
	        <p>地址：天津市北辰区永进道96号&nbsp;&nbsp;&nbsp;&nbsp;邮编：300400&nbsp;&nbsp;&nbsp;&nbsp;Copyright © 2015 - 2016 ALLRighhts Reserved</p>
	    </div>
	</div>
	<!--foot e-->
</body>
</html>
